package com.seuic.hnjiningposapp.hnapps.ui.adapter;


import androidx.annotation.Nullable;


import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.seuic.hnjiningposapp.R;
import com.seuic.hnjiningposapp.hnapps.base.BaseActivity;
import com.seuic.hnjiningposapp.hnapps.base.BaseAdapter;

import java.util.List;


/**
 * 九宫格适配器
 *
 * @author rainking
 */
public class ItemGridMainAdapter extends BaseAdapter<ItemGridMainAdapter.GridMain> {

    public ItemGridMainAdapter(@Nullable List<GridMain> data) {
        super(R.layout.item_grid_main, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, GridMain item) {
        helper.setText(R.id.tv_title, item.getTitle());
        helper.setBackgroundResource(R.id.iv_icon, item.getIcon());
    }


    public static class GridMain {

        /**
         * 图标
         */
        private int icon;
        /**
         * 标题
         */
        private String title;
        /**
         * 显示 true 不显示 false
         */
        private boolean isShow = true;

        /**
         * 对应的安卓页面
         */
        private Class<? extends BaseActivity> cls;

        public GridMain(int icon, String title, boolean isShow, Class<? extends BaseActivity> cls) {
            this.icon = icon;
            this.title = title;
            this.isShow = isShow;
            this.cls = cls;
        }

        public GridMain(int icon, String title, Class<? extends BaseActivity> cls) {
            this.icon = icon;
            this.title = title;
            this.cls = cls;
        }

        public int getIcon() {
            return icon;
        }

        public void setIcon(int icon) {
            this.icon = icon;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public boolean isShow() {
            return isShow;
        }

        public void setShow(boolean show) {
            isShow = show;
        }

        public Class<? extends BaseActivity> getCls() {
            return cls;
        }

        public void setCls(Class<? extends BaseActivity> cls) {
            this.cls = cls;
        }
    }

}
